﻿using DapperExtensions.Mapper;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace DapperExt.Web.Models
{
    /// <summary>
    /// x_userEntity管理用户:实体类(属性说明自动提取数据库字段的描述信息)
    /// </summary>
    [Serializable]
    public partial class x_userEntity
    {
        /// <summary>
        /// 
        /// </summary>
        public x_userEntity()
        { }
        #region Model
        private int _id;
        private string _username;
        private string _realname;
        private string _password;
        private int? _roleid = 0;
        private int? _status = 0;
        private DateTime? _createon;
        private DateTime? _updateon;
        private int? _createby = 0;
        private int? _updateby = 0;
        private int? _gender = 0;
        private string _phone;
        private string _email;
        private string _remark;
        private string _headshot;
        /// <summary>
        /// Id自增主键
        /// </summary>
        public int Id
        {
            set { _id = value; }
            get { return _id; }
        }
        /// <summary>
        /// 用户名(登录名)
        /// </summary>
        public string UserName
        {
            set { _username = value; }
            get { return _username; }
        }
        /// <summary>
        /// 姓名
        /// </summary>
        public string RealName
        {
            set { _realname = value; }
            get { return _realname; }
        }
        /// <summary>
        /// 密码
        /// </summary>
        public string PassWord
        {
            set { _password = value; }
            get { return _password; }
        }
        /// <summary>
        /// 角色Id
        /// </summary>
        public int? RoleId
        {
            set { _roleid = value; }
            get { return _roleid; }
        }
        /// <summary>
        /// 状态
        /// </summary>
        public int? Status
        {
            set { _status = value; }
            get { return _status; }
        }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime? CreateOn
        {
            set { _createon = value; }
            get { return _createon; }
        }
        /// <summary>
        /// 修改时间
        /// </summary>
        public DateTime? UpdateOn
        {
            set { _updateon = value; }
            get { return _updateon; }
        }
        /// <summary>
        /// 创建者
        /// </summary>
        public int? CreateBy
        {
            set { _createby = value; }
            get { return _createby; }
        }
        /// <summary>
        /// 修改者
        /// </summary>
        public int? UpdateBy
        {
            set { _updateby = value; }
            get { return _updateby; }
        }
        /// <summary>
        /// 性别(1男0女)
        /// </summary>
        public int? Gender
        {
            set { _gender = value; }
            get { return _gender; }
        }
        /// <summary>
        /// 手机
        /// </summary>
        public string Phone
        {
            set { _phone = value; }
            get { return _phone; }
        }
        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email
        {
            set { _email = value; }
            get { return _email; }
        }
        /// <summary>
        /// 备注
        /// </summary>
        public string Remark
        {
            set { _remark = value; }
            get { return _remark; }
        }
        /// <summary>
        /// 头像
        /// </summary>
        public string HeadShot
        {
            set { _headshot = value; }
            get { return _headshot; }
        }

        //[Computed] 无作用
        public string RoleName { get; set; }
        #endregion Model
    }

    /// <summary>
    /// 实体对象映射关系  
    /// </summary>
    [Serializable]
    internal class x_userEntityMapper : ClassMapper<x_userEntity>
    {
        public x_userEntityMapper()
        {
            base.Table("x_user");
            Map(f => f.Id).Key(KeyType.Identity);
            Map(f => f.RoleName).Ignore();
            AutoMap();
        }
    }
}